package com.ruoyi.project.wx.reserve.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.wx.reserve.domain.WxMakeCar;
import com.ruoyi.project.wx.reserve.service.WxMakeCarService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 预约信息
 * 
 * @author ruoyi
 */
@Controller
@RequestMapping("/wx/reserve")
public class WxMakeCarController extends BaseController
{
    private String prefix = "wx/reserve";

    @Autowired
    private WxMakeCarService wxMakeCarService;

    @RequiresPermissions("wx:reserve:view")
    @GetMapping()
    public String toMakList()
    {
        return prefix + "/list";
    }

    @RequiresPermissions("wx:reserve:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(WxMakeCar wxMakeCar) {
        startPage();
        List<WxMakeCar> wxMakeCarList = wxMakeCarService.selectMakeList(wxMakeCar);
        return getDataTable(wxMakeCarList);
    }

    /**
     * 修改
     */
    @RequiresPermissions("wx:reserve:updateStatus")
    @PostMapping("/updateStatus")
    @ResponseBody
    public AjaxResult edit(WxMakeCar wxMakeCar)
    {
        return toAjax(wxMakeCarService.updateMakeStatus(wxMakeCar));
    }

    @RequiresPermissions("wx:reserve:remove")
    @PostMapping("/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        try
        {
            return toAjax(wxMakeCarService.delMakeByIds(ids));
        }
        catch (Exception e)
        {
            return error(e.getMessage());
        }
    }


}
